#ifndef __DEV_COMMON_H
#define __DEV_COMMON_H

#include "drv_base.h"
#include "stm32.h"

#ifdef __cplusplus
extern "C" {
#endif

void Error_Handler(void);
void SystemClock_Config(void);
void EnableDevCLK(void *dev);
void PrintRegister(char *varName, uint32_t var);

#define     HANDLE_SP_EXCEPTION(handler)        ABS_ASM (                          \
                                                "tst lr, #4\n\t"                   \
                                                "ite eq\n\t"                       \
                                                "mrseq r0, msp\n\t"                \
                                                "mrsne r0, psp\n\t"                \
                                                "mov pc,%0\n\t"                    \
                                                :                                  \
                                                : "r" (handler)                    \
                                                :                                  \
                                                );

#if __INTELLISENSE__
#pragma diag_suppress 1094
#endif

#ifdef __cplusplus
}
#endif
#endif